﻿<UserControl x:Class="ForumsBrowser.MessageDetailControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:fb="clr-namespace:ForumsBrowser"
    x:Name="messageDetail" HorizontalAlignment="Stretch" Margin="5,5,5,5"
    FontFamily="Lucida Sans">
    <UserControl.Resources>
        <fb:DateTimeTextConverter x:Key="DateTimeTextConverter"/>
        <fb:MessageColorConverter x:Key="MessageColorConverter"/>
    </UserControl.Resources>
    <Grid>   

        <Border x:Name="border" BorderThickness="2" BorderBrush="Black" Margin="5,5,5,5" CornerRadius="5,5,5,5">
            <Border.Effect>
                <DropShadowEffect BlurRadius="5" ShadowDepth="5">
                </DropShadowEffect>
            </Border.Effect>
            <Border.Background>
                <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                    <LinearGradientBrush.GradientStops>
                        <GradientStop Color="Black" Offset="0"/>
                        <GradientStop Color="{Binding ElementName=messageDetail, Path=Message.Status, Converter={StaticResource MessageColorConverter} }" Offset="1"/>
                    </LinearGradientBrush.GradientStops>
                </LinearGradientBrush>
            </Border.Background>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <fb:UserHeader Grid.Column="0" x:Name="userHeader" User="{Binding ElementName=messageDetail, Path=Message.Author}"/>
                <StackPanel Orientation="Vertical" Grid.Column="1" HorizontalAlignment="Right"
                            Margin="5,5,10,5" VerticalAlignment="Center" >
                    <TextBlock FontSize="12" HorizontalAlignment="Right" TextTrimming="CharacterEllipsis" Text="{Binding ElementName=messageDetail, Path=Message.CreatedOn, Converter={StaticResource DateTimeTextConverter } }"/>
                    <TextBlock FontSize="12" HorizontalAlignment="Right" TextTrimming="CharacterEllipsis">
                        <TextBlock.Text>
                            <MultiBinding StringFormat="{}Helpful Votes: {0}">
                                <Binding ElementName="messageDetail" Path="Message.HelpfulVotes"/>
                            </MultiBinding>
                        </TextBlock.Text>
                    </TextBlock>
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</UserControl>
